package com.cardone.platform.configuration.service;

import java.util.List;

import lombok.Getter;
import lombok.Setter;

import com.cardone.common.dto.PaginationDto;
import com.cardone.context.ContextHolder;
import com.cardone.platform.configuration.dao.DictionaryItemDao;
import com.cardone.platform.configuration.dto.DictionaryItemDto;

/**
 * 字典项服务
 *
 * @author yaohaitao
 *
 */
@Getter
@Setter
public class DictionaryItemDefaultService implements DictionaryItemService {
	@Override
	public int deleteByIds(final DictionaryItemDto deleteDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).deleteByIds(deleteDictionaryItem);
	}

	@Override
	public <P> P findByCodeOrId(final Class<P> mappedClass, final DictionaryItemDto findDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).findByCodeOrId(mappedClass, findDictionaryItem);
	}

	@Override
	public <P> P findById(final Class<P> mappedClass, final DictionaryItemDto findDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).findById(mappedClass, findDictionaryItem);
	}

	@Override
	public <P> List<P> findListByLikeCode(final Class<P> mappedClass, final DictionaryItemDto findListDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).findListByLikeCode(mappedClass, findListDictionaryItem);
	}

	@Override
	public int insertByCode(final DictionaryItemDto insertDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).insertByCode(insertDictionaryItem);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(final Class<P> mappedClass, final DictionaryItemDto paginationDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).paginationByLikeCode(mappedClass, paginationDictionaryItem);
	}

	@Override
	public Integer readByCodeNqIdForCount(final DictionaryItemDto readDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).readByCodeNqIdForCount(readDictionaryItem);
	}

	@Override
	public <P> P saveByIdOrCode(final Class<P> mappedClass, final DictionaryItemDto saveDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).saveByIdOrCode(mappedClass, saveDictionaryItem);
	}

	@Override
	public int updateByCode(final DictionaryItemDto updateDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).updateByCode(updateDictionaryItem);
	}
}